﻿<%@ Page Language="C#" MasterPageFile="~/MasterPageSERIX.Master" AutoEventWireup="true"
    CodeBehind="RelatorioMensalExe.aspx.cs" Inherits="SERIX.RelatorioMensalExe" Title="Registro Mensal de Execução" %>

<%@ Register Src="Controles/Navegador.ascx" TagName="Navegador" TagPrefix="uc3" %>
<%@ Register Src="Controles/lovGenerica.ascx" TagName="lovGenerica" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table width="97%" border="0" cellspacing="0" cellpadding="2" align="center">
        <tr>
            <td class="secao_titulo" style="width: 284px">
                Registro Mensal de Execução<hr class="linhaHorizontal" style="width: 740px" />
            </td>
        </tr>
    </table>
    <asp:UpdatePanel ID="UpdatePanelFiltro" runat="server">
        <ContentTemplate>
            <table align="center" border="0" cellpadding="2" cellspacing="0" width="97%">
                <tr>
                    <td align="center" class="grid_titulo">
                        <span style="color: #FFFFFF">Ano: </span>
                        <asp:TextBox ID="txtAno" Columns="4" MaxLength="4" runat="server" OnPreRender="txtAno_PreRender"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtAno"
                            CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                            TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                        &nbsp;&nbsp;&nbsp;<span style="color: #FFFFFF">&nbsp;Mês: </span>
                        <asp:DropDownList ID="ddlMeses" runat="server" OnPreRender="ddlMeses_PreRender">
                            <asp:ListItem />
                            <asp:ListItem Value="1" Text="Janeiro"></asp:ListItem>
                            <asp:ListItem Value="2" Text="Fevereiro"></asp:ListItem>
                            <asp:ListItem Value="3" Text="Março"></asp:ListItem>
                            <asp:ListItem Value="4" Text="Abril"></asp:ListItem>
                            <asp:ListItem Value="5" Text="Maio"></asp:ListItem>
                            <asp:ListItem Value="6" Text="Junho"></asp:ListItem>
                            <asp:ListItem Value="7" Text="Julho"></asp:ListItem>
                            <asp:ListItem Value="8" Text="Agosto"></asp:ListItem>
                            <asp:ListItem Value="9" Text="Setembro"></asp:ListItem>
                            <asp:ListItem Value="10" Text="Outubro"></asp:ListItem>
                            <asp:ListItem Value="11" Text="Novembro"></asp:ListItem>
                            <asp:ListItem Value="12" Text="Dezembro"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="ddlMeses"
                            CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                            TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td align="center" class="grid_titulo">
                        <span style="color: #FFFFFF">Técnico: </span>
                        <asp:TextBox ID="txtNomeTecnico" runat="server" Columns="40" MaxLength="60" Enabled="false"></asp:TextBox>
                        <uc1:lovGenerica ID="lovTecnicos" runat="server" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtNomeTecnico"
                            CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                            TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                        &nbsp;&nbsp;&nbsp;<span style="color: #FFFFFF">Município: </span>
                        <asp:DropDownList ID="ddlMunicipios" runat="server" DataSourceID="SqlMunicipios"
                            DataTextField="NOME_MUN" DataValueField="IDT_MUN" AutoPostBack="True" OnSelectedIndexChanged="ddlMunicipios_SelectedIndexChanged">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="ddlMunicipios"
                            CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                            TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                        <asp:SqlDataSource ID="SqlMunicipios" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT  B.IDT_MUN, B.NOME_MUN FROM Serix.SRX_LOTACOES_TECNICOS A JOIN Serix.SRX_MUNICIPIOS B ON (A.IDT_TEC = :PARAM AND A.IDT_MUN = B.IDT_MUN AND A.STA_LOTACAO = 'A') ORDER BY NOME_MUN ">
                            <SelectParameters>
                                <asp:Parameter Name="PARAM" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </td>
                </tr> 
               <tr>
                    <td align="center" class="grid_titulo">
                        <span style="color: #FFFFFF">Programa: </span>
                        <asp:DropDownList ID="ddlProgramas" runat="server" AutoPostBack="True" DataSourceID="SqlProgramas"
                            DataTextField="NOM_PROG" DataValueField="IDT_PROG" OnSelectedIndexChanged="ddlProgramas_SelectedIndexChanged">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="ddlProgramas"
                            CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                            TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                        <asp:SqlDataSource ID="SqlProgramas" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT P.IDT_PROG, P.NOM_PROG FROM SERIX.SRX_PROGRAMAS P 
      JOIN SERIX.SRX_PROGRAMAS_MUNICIPIOS PM ON (P.IDT_PROG = PM.IDT_PROG)
WHERE PM.IDT_MUN = :P_IDT_MUN
ORDER BY P.NOM_PROG">
                            <SelectParameters>
                                <asp:Parameter Name="P_IDT_MUN" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </td>
                </tr>
                <tr>
                    <td align="center" class="grid_titulo">
                        <span style="color: #FFFFFF">Ação: </span>
                        <asp:DropDownList ID="ddlAcoes" runat="server" DataSourceID="SqlAcoesPrograma" DataTextField="DSC_ACAO"
                            DataValueField="IDT_ACAO" AutoPostBack="True" OnSelectedIndexChanged="ddlAcoes_SelectedIndexChanged">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="ddlAcoes"
                            CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                            TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                        <asp:SqlDataSource ID="SqlAcoesPrograma" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT IDT_ACAO, DSC_ACAO FROM SERIX.SRX_ACOES_PROGRAMAS WHERE IDT_PROG = :PARAM ORDER BY DSC_ACAO">
                            <SelectParameters>
                                <asp:Parameter Name="PARAM" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </td>
                </tr>
                <tr>
                    <td align="center" class="grid_titulo">
                        <span style="color: #FFFFFF">Indicador: </span>
                        <asp:DropDownList ID="ddlIndicadores" runat="server" DataSourceID="SqlIndicadoresAcao"
                            DataTextField="DSC_IND" DataValueField="IDT_IND">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlIndicadores"
                            CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                            TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                        <asp:SqlDataSource ID="SqlIndicadoresAcao" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT IDT_IND, DSC_IND FROM Serix.SRX_INDICADORES_ACOES WHERE IDT_ACAO = :PARAM ORDER BY DSC_IND">
                            <SelectParameters>
                                <asp:Parameter Name="PARAM" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                        &nbsp;&nbsp;&nbsp;<asp:Button ID="btnPequisar" runat="server" Font-Bold="True" OnClick="btnPequisar_Click"
                            TabIndex="5" Text="Pesquisar" Width="80px" />
                        &#160;&#160;<asp:Button ID="btnLimpar" runat="server" CausesValidation="false" Font-Bold="True"
                            OnClick="btnLimpar_Click" TabIndex="6" Text="Limpar" UseSubmitBehavior="False"
                            Width="80px" />
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
    <table width="97%" border="0" cellspacing="0" cellpadding="2" align="center">
        <tr>
            <td align="left" style="color: #000000">
                <asp:Label ID="lblFiltro" runat="server" CssClass="filtro" TabIndex="-1" Text="Filtro: "></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="center" style="color: #000000">
                <asp:GridView ID="gridView" runat="server" AutoGenerateColumns="False" CssClass="grid"
                    OnRowDataBound="gridView_RowDataBound" EmptyDataText="Nenhum registro encontrado.">
                    <AlternatingRowStyle CssClass="row_alter" />
                    <Columns>
                        <asp:BoundField DataField="TIT_DESCRICAO" HeaderText="Tipo" ItemStyle-Width="250px">
                            <ItemStyle Width="250px"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="DESCRICAO" HeaderText="Descrição" ItemStyle-Width="520px">
                            <ItemStyle Width="520px"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="UNIDADE" HeaderText="Unid." ItemStyle-Width="70px">
                            <ItemStyle Width="70px" HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="META" HeaderText="Meta" ItemStyle-Width="100px">
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle Width="100px" HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="PRODUCAO" HeaderText="Produção" ItemStyle-Width="100px">
                            <ItemStyle Width="100px" HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="REALIZADO" HeaderText="Realizado" ItemStyle-Width="100px">
                            <ItemStyle Width="100px" HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:TemplateField FooterText="Detalhes" HeaderText="Detalhes" ItemStyle-Width="70px">
                            <ItemTemplate>
                                <asp:HyperLink ID="Detalhes_HyperLink" runat="server" ImageUrl="Imagens/botoes/Detail.png">Detalhes</asp:HyperLink>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataRowStyle CssClass="emptyrow" />
                    <FooterStyle CssClass="footer" />
                    <HeaderStyle CssClass="header" />
                    <PagerStyle CssClass="pager" />
                    <RowStyle CssClass="row" />
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td align="center" style="color: #000000">
                <uc3:Navegador ID="Navegador1" runat="server" />
            </td>
        </tr>
        <tr>
            <td align="center" style="color: #000000">
            </td>
        </tr>
    </table>
</asp:Content>
